package com.start.handler;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.start.bean.Account;
import com.start.bean.User;
import com.start.bean.User2;

@Controller
public class HelloWorld {
	/**
	 * 1.使用@RequestMapping("/helloworld")来映射请求的URL
	 * 2.返回值会通过视图解析器解析为实际的物理视图:
	 * 对于InternalResourceViewResolver类来说，会在内部做如下的解析：
	 * 通过prefix + @RequestMapping注解方法的返回值 + suffix（后缀），来解析得到实际的物理视图地址，然后做转发操作。
	 * 
	 * @return
	 */
	@RequestMapping("/helloworld")
	public String hello(String username) {
		System.out.println("HelloWorld.hello()///------------->>>>>." + username);
		return "success";
	}

	/**
	 * 
	 * @param username
	 * @return
	 */
	@RequestMapping("/setAccount")
	public String setAccount(Account account, User user) {
		System.out.println("HelloWorld.setAccount()>>" + account);
		System.out.println("HelloWorld.setAccount()>>" + user);
		return "success";
	}

	@RequestMapping("/setListAndMap")
	public String setListAndMap(Account account) {
		System.out.println("HelloWorld.setAccount()>>" + account);
		return "success";
	}

	@RequestMapping("/setAuto")
	public String setAuto(User2 user) {
		System.out.println("HelloWorld.setAuto()" + user);
		return "success";
	}
	
	
}
